package com.pjhouse.module.screen.user;

import java.util.List;

import javax.annotation.Resource;

import com.alibaba.citrus.turbine.Context;
import com.alibaba.citrus.turbine.TurbineRunData;
import com.alibaba.citrus.turbine.dataresolver.Param;
import com.pjhouse.core.common.domain.Result;
import com.pjhouse.core.user.domain.UserDTO;
import com.pjhouse.core.user.service.UserService;

public class UserList {
	
	@Resource
	private UserService userService;
	
	public void execute(
			@Param("id") final long id,
			TurbineRunData rundata, Context context){
		if(id <= 0){
			context.put("message", "参数错误");
			return ;
		}
		Result<List<UserDTO>> r = userService.getUserList();
		if(r.isFailure()){
			context.put("message", r.getErrorMessage());
			return ;
		}
		List<UserDTO> users = r.getValue();
		if(users == null){
			context.put("message", "对应账号不存在");
			return ;
		}
		context.put("userList", users);
	}
}
